package com.park.dailytool.enums;

/**
 * @author huangding
 * @description
 * @date 2018/12/10 9:51
 */
public enum OrderType {
    /**
     * 支付类型1=缴费2=折扣充值3=余额扣款 4=年充值 5=月充值6免费
     */
    PAY(1, "缴费"),
    DISCOUNT(2, "折扣充值"),
    BALANCE(3, "余额扣款"),
    ANNUAL_FEE(4, "年费"),
    MONTHLY_FEE(5, "月费"),
    FREE(6, "免费订单"),
    ;
    private Integer code;

    private String val;

    OrderType(Integer code, String val) {
        this.code = code;
        this.val = val;
    }

    public static OrderType getOrderType(Integer type) {
        if (null == type) {
            return null;
        }
        for (OrderType v : values()) {
            if (v.getCode().equals(type)) {
                return v;
            }

        }
        return null;
    }

    public Integer getCode() {
        return code;
    }

    public String getVal() {
        return val;
    }
}
